lib/repo: Fix double-set-error in min-free-space-size code
authorColin Walters <walters@verbum.org>
Mon, 18 Jun 2018 14:36:33 +0000 (10:36 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 19 Jun 2018 18:29:31 +0000 (18:29 +0000)
We need to pass `NULL` as the error, we only care if the key exists;
otherwise we'll try to set the error twice.

Closes: #1632
Approved by: jlebon

src/libostree/ostree-repo.c

index fa5a9bf87cdc44ee8a4f087faf39ebfcdb959a27..8e7e4ca0bf67a56fb7e43a476feb9fa22996a377 100644 (file)
@@ -2670,7 +2670,7 @@ min_free_space_size_validate_and_convert (OstreeRepo    *self,
 
   g_autoptr(GMatchInfo) match = NULL;
   if (!g_regex_match (regex, min_free_space_size_str, 0, &match))
-    return glnx_prefix_error (error, "Error parsing min-free-space-size parameter: '%s'", min_free_space_size_str);
+    return glnx_prefix_error (error, "Failed to parse min-free-space-size parameter: '%s'", min_free_space_size_str);
 
   g_autofree char *size_str = g_match_info_fetch (match, 1);
   g_autofree char *unit = g_match_info_fetch (match, 2);
@@ -2814,12 +2814,12 @@ reload_core_config (OstreeRepo          *self,
   }
 
   {
-    if (g_key_file_has_key (self->config, "core", "min-free-space-size", error) &&
-        g_key_file_has_key (self->config, "core", "min-free-space-percent", error))
+    if (g_key_file_has_key (self->config, "core", "min-free-space-size", NULL) &&
+        g_key_file_has_key (self->config, "core", "min-free-space-percent", NULL))
       {
-        return glnx_throw (error, "min-free-space-percent and min-free-space-size are mutually exclusive.");
+        return glnx_throw (error, "min-free-space-percent and min-free-space-size are mutually exclusive");
       }
-    else if (g_key_file_has_key (self->config, "core", "min-free-space-size", error))
+    else if (g_key_file_has_key (self->config, "core", "min-free-space-size", NULL))
       {
         g_autofree char *min_free_space_size_str = NULL;